package bishihuizong;
import java.io.*;
/**
 * Created by JiaJia on 2019/9/22 0022.
 */
public class Vivo03 {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String inputStr = br.readLine();
        int input[] = parseInts(inputStr.split(" "));
        int output = solution(input);
        System.out.println(output);
    }

    private static int[] parseInts(String[] strArr) {
        if (strArr == null || strArr.length == 0) {
            return new int[0];
        }
        int[] intArr = new int[strArr.length];
        for (int i = 0; i < intArr.length; i++) {
            intArr[i] = Integer.parseInt(strArr[i]);
        }
        return intArr;
    }

    private static int solution(int[] input) {

        if (input.length==1){
            return 0;
        }
        int terminal=0;
        int max=0;
        int step=0;
        for (int i = 0; i <input.length-1 ; i++) {
            max=Math.max(max,input[i]+1);
            if (i==terminal){
                terminal=max;
                step++;
            }
        }

        return step;
    }
}